
#include "Servo.h"


extern TIM_HandleTypeDef htim4;

void ServoSet(uint8_t ySer, uint16_t yAngle)
{
    uint16_t AngleCount;
    AngleCount = SER_START_COUNT + SER_ANGLE_COUNT * yAngle;
    if(AngleCount > SER_MAX_COUNT)
        AngleCount = SER_MAX_COUNT;

    switch (ySer)
    {
    case 1:
        htim4.Instance->CCR1 = (uint16_t)AngleCount;
        break;
    case 2:
        htim4.Instance->CCR2 = (uint16_t)AngleCount;
        break;
    case 3:
        htim4.Instance->CCR3 = (uint16_t)AngleCount;
        break;
    case 4:
        htim4.Instance->CCR4 = (uint16_t)AngleCount;
        break;

    }

}
/********************************End of File************************************/

